/***************************************************
 ** @Desc : This file for ...
 ** @Time : 2018/9/14 15:31 
 ** @Author : Joker
 ** @File : redis_new
 ** @Last Modified by : Joker
 ** @Last Modified time: 2018/9/14 15:31
 ** @Software: GoLand
****************************************************/
package utils

import (
	"gopkg.in/redis.v5"
	"github.com/astaxie/beego"
	"strconv"
)

func InitRedis() *redis.Client {
	pool := beego.AppConfig.String("cache::redis_pool")
	poolsize, _ := strconv.Atoi(pool)
	return redis.NewClient(&redis.Options{
		Addr:     beego.AppConfig.String("cache::redis_host"),
		Password: beego.AppConfig.String("cache::redis_password"),
		DB:       15,
		PoolSize: poolsize,
	})
}

/*获取连接*/
func GetRedis() *redis.Client {
	return InitRedis()
}
